﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Data;
using DataAccess;

namespace Web.giaovien
{
    public partial class UCChiTiet : System.Web.UI.UserControl
    {
        ThongBaoControl tbCtr = new ThongBaoControl();
        ThongBao tb = new ThongBao();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    LoadThongBao();
                }
                else
                {
                    Response.Redirect("giaovienpage.aspx?page=thongbao");
                }
            }
        }

        private void LoadThongBao()
        {
            int id = Int32.Parse(Request.QueryString["id"].ToString());
            tb = tbCtr.GetThongBaoById(id);
            lblTieuDe.Text = tb.TieuDe;
            lblNoiDung.Text = tb.NoiDung;
            lblNgayDang.Text = tb.NgayTao.ToString();
        }
    }
}